<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/3/25
  Time: 20:35
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>layout 后台大布局 - Layui</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/layui/css/layui.css">
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <jsp:include page="../common/header.jsp"></jsp:include>
    <jsp:include page="../common/menu.jsp"></jsp:include>

    <div class="layui-body">
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>部门分类</legend>
        </fieldset>
        <fieldset class="layui-elem-field site-demo-button" style="margin-top: 20px;">
            <div>
                <button id="insertDept" type="button" class="layui-btn layui-btn-normal">添加部门</button>
            </div>
        </fieldset>
            <table class="layui-table">
                <colgroup>
                    <col width="150">
                    <col width="150">
                    <col width="200">
                    <col>
                </colgroup>
                <thead>
                <tr>
                    <th><input type="checkbox" name="check"></th>
                    <th>id</th>
                    <th>部门名称</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach items="${list}" var="dept">
                    <tr>
                        <td><input type="checkbox" class="dept" name="check"></td>
                        <td>${dept.id}</td>
                        <td>${dept.deptName}</td>
                        <td><a  href="${pageContext.request.contextPath}/dept/updateUI?id=${dept.id}" class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
                            <a onclick="delDept('${dept.id}')" href="javascript:;">删除</a> </td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
    </div>
</div>
<%--<script src="${pageContext.request.contextPath}/layui/css/layui.css"></script>--%>
<script src="${pageContext.request.contextPath}/layui/layui.js"></script>
<script>
    //JavaScript代码区域
    layui.use(['jquery','layer'], function(){
        var $=layui.$;
        var layer=layui.layer;
        $("#insertDept").click(function () {
           location.href="${pageContext.request.contextPath}/dept/insertUI"
        });
    });
    function delDept(id) {
        layer.confirm('确认删除吗?',{icon:3,title:'提示'},function () {
            location.href="${pageContext.request.contextPath}/dept/del?id="+id;
            alert(aa);
            layer.close(index);
        });
    }
</script>
</body>
</html>
